/**
 * 
 */

var title = 'Expr Web Rev:'+version+' '+cmtime;
var current_patient  = null;
current_data ={};

var main_win = new Ext.Window({
		maximized :true,
		width : 450,
		height : 355,
		closable : false,
		resizable : false,
		plain : true,
		border : false,
		layout:'border',
		defaults: {
    		split: true
		},
		items: [
			{
    		title: title,
    		region:'west',
    		width:740,
    		margins: '5 0 0 5',
    		layout:'border',
    		items:[
    			title_panel,
    			{
    				
    				region:'center',
    				layout:'border',
    				width:740,
    				items:[
    				      	filter_panel,
    			            {
    				              xtype  : 'container',
    				              title:'Patients:',
    				              border:true,
    				              region : 'center',
    				              layout : 'fit',
    				              id     : 'cp_patients_view',
    				              margins: '0 5 5 5',
    				              items  : {
    				                title : 'Patients',
    				                id    : 'patients_panel',
    				                html  : 'no_patients',
    				                frame : true
    				              }
    				              
    				           }
    				       ]
    			}
    			
    		]},
			{
    		title: 'Navigation',
    		region:'center',
    		margins: '5 5 0 0',
    		cmargins: '5 5 0 0',
    		layout:'border',
    		items:[top_patient_panel,
    		       top_main_panel
    		       ]
			}
		]
		

});//main_win
raw_patients_data =null;
raw_types_data=null;
receive_patient_data= function(){
	var callback = function(response, e){
		main_win.enable();
		if (true === e.status) {
			raw_patients_data = response.data;
			raw_types_data    = response.types;
		
			c=Ext.ComponentMgr.get('combo_patient_type');
			c.store.proxy  = new Ext.data.MemoryProxy(raw_types_data);
			c.store.reload();
		}
		load_myMask.hide();
	};
	  load_myMask = new Ext.LoadMask(Ext.getBody(), {  
		                     msg : "Now loading. Please wait...."  
	                 });  
	  load_myMask.show();
	  main_win.disable();
	Patient_Filter.avialable_patients(callback);
}
	
Ext.onReady(function(){
		Ext.EventManager.onWindowResize(function(w,h){
			main_win.setSize(w,h);
			main_win.maximize();
		})
		main_win.show();
		document.title=title;
		receive_patient_data();
		
		//Ext.Msg.alert('hello',ds_filterDepartment.getAt(0).get('name'));
		//Patient_Filter.avialable_department(callback)			
});
	





